package com.gaohe.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gaohe.pojo.UserCard;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UserCardMapper extends BaseMapper<UserCard> {
    //根据会员 id 查询会员卡
    @Select("SELECT uc.* FROM user_card uc " +
            "LEFT JOIN  card c  ON c.id = uc.card_id " +
            "LEFT JOIN `user` u  ON u.id = uc.user_id " +
            "WHERE u.id = #{id}")
    List<UserCard> getCardsByUserId(@Param("id") Long id);
}
